﻿function buscarCoordenada(form) {
    if (IsNumber(form.Lat.value) == false || IsNumber(form.Long.value) == false ||
         form.Long.value=="" || form.Lat.value=="") {
        alert('Los valores ingresados deben ser coordenadas válidas');

    }
    else {
        initialize(form.Lat.value, form.Long.value);
    }
}

function IsNumber() {
    var argv = IsNumber.arguments;
    var argc = argv.length;

    var check = true;
    var value = argv[0]; //get characters
    //check that all characters are digits, ., -, or ""
    for (var i = 0; i < argv[0].length; ++i) {
        var new_key = value.charAt(i); //cycle through characters
        if (((new_key < "0") || (new_key > "9")) &&
                     !(new_key == ".") && !(new_key == "-")) {
            check = false;
            break;
        }
    }

    //apply appropriate colour based on value
    if (!check) {
        return false;
    }
    else {

        return true;
    }
}